package com.imut.lagain.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Map;

/**
 * 通知模板实体类
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("notification_template")
public class NotificationTemplate implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键ID
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 模板代码（唯一标识）
     */
    @TableField("code")
    private String code;

    /**
     * 模板名称
     */
    @TableField("name")
    private String name;

    /**
     * 微信模板ID
     */
    @TableField("wechat_template_id")
    private String wechatTemplateId;

    /**
     * 通知类型
     */
    @TableField("type")
    private Notification.NotificationType type;

    /**
     * 模板标题
     */
    @TableField("title")
    private String title;

    /**
     * 模板内容
     */
    @TableField("content")
    private String content;

    /**
     * 微信模板数据
     */
    @TableField("wechat_data")
    private String wechatData;

    /**
     * 小程序页面路径
     */
    @TableField("mini_program_page")
    private String miniProgramPage;

    /**
     * 跳转URL
     */
    @TableField("url")
    private String url;

    /**
     * 是否启用
     */
    @TableField("enabled")
    private Boolean enabled;

    /**
     * 发送条件
     */
    @TableField("send_condition")
    private String sendCondition;

    /**
     * 频率限制（分钟）
     */
    @TableField("frequency_limit")
    private Integer frequencyLimit;

    /**
     * 过期时间（小时）
     */
    @TableField("expire_hours")
    private Integer expireHours;

    /**
     * 优先级
     */
    @TableField("priority")
    private Integer priority;

    /**
     * 模板描述
     */
    @TableField("description")
    private String description;

    /**
     * 创建者ID
     */
    @TableField("creator_id")
    private Long creatorId;

    /**
     * 创建时间
     */
    @TableField(value = "created_at", fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createdAt;

    /**
     * 更新时间
     */
    @TableField(value = "updated_at", fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updatedAt;

    /**
     * 是否删除
     */
    @TableField("is_deleted")
    @TableLogic
    private Boolean isDeleted;

    // 手动添加getter和setter方法以确保编译通过
    public Long getId() {
        return id;
    }

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public Notification.NotificationType getType() {
        return type;
    }

    public String getTitle() {
        return title;
    }

    public String getContent() {
        return content;
    }

    public String getUrl() {
        return url;
    }

    public Boolean getEnabled() {
        return enabled;
    }

    public Integer getFrequencyLimit() {
        return frequencyLimit;
    }

    public Integer getExpireHours() {
        return expireHours;
    }

    public Integer getPriority() {
        return priority;
    }

    public String getSendCondition() {
        return sendCondition;
    }

    public String getWechatTemplateId() {
        return wechatTemplateId;
    }

    public void setWechatTemplateId(String wechatTemplateId) {
        this.wechatTemplateId = wechatTemplateId;
    }

    public void setIsDeleted(Boolean isDeleted) {
        this.isDeleted = isDeleted;
    }

    public Boolean getIsDeleted() {
        return isDeleted;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setType(Notification.NotificationType type) {
        this.type = type;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public void setEnabled(Boolean enabled) {
        this.enabled = enabled;
    }

    public void setFrequencyLimit(Integer frequencyLimit) {
        this.frequencyLimit = frequencyLimit;
    }

    public void setExpireHours(Integer expireHours) {
        this.expireHours = expireHours;
    }

    public void setPriority(Integer priority) {
        this.priority = priority;
    }

    public void setSendCondition(String sendCondition) {
        this.sendCondition = sendCondition;
    }

    public void setCreatedAt(LocalDateTime createdAt) {
        this.createdAt = createdAt;
    }

    public void setUpdatedAt(LocalDateTime updatedAt) {
        this.updatedAt = updatedAt;
    }

    public LocalDateTime getCreatedAt() {
        return createdAt;
    }

    public LocalDateTime getUpdatedAt() {
        return updatedAt;
    }

    public String getWechatData() {
        return wechatData;
    }

    public void setWechatData(String wechatData) {
        this.wechatData = wechatData;
    }

    public String getMiniProgramPage() {
        return miniProgramPage;
    }

    public void setMiniProgramPage(String miniProgramPage) {
        this.miniProgramPage = miniProgramPage;
    }

    public String getRedirectUrl() {
        return url;
    }

    public String getTemplateId() {
        return wechatTemplateId;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Long getCreatorId() {
        return creatorId;
    }

    public void setCreatorId(Long creatorId) {
        this.creatorId = creatorId;
    }
}